package com.atguigu.product.service.impl;

import com.atguigu.product.bean.Product;
import com.atguigu.product.service.ProductService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;

/**
 * @author: dh
 * @date: 2025-03-21 17:33
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Override
    public Product getProductById(Long productId) {

        Product product = new Product();
        // 制造一个假数据.
        product.setId(productId);
        product.setPrice(new BigDecimal("99"));
        product.setProductName("苹果-" + productId);
        product.setNum(2);

        try {

            TimeUnit.SECONDS.sleep(100);
        } catch (InterruptedException e) {

            throw new RuntimeException(e);
        }
        return product;
    }
}
